<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
<div region="center" style="padding: 1px;">
<t:datagrid name="inAllAccountInfoList" title="内部/总账账户信息查询" onLoadSuccess="onLoadSuccess" autoLoadData="false" actionUrl="judicialControll.do?inAllAccountInfoQuery" fitColumns="true"
	idField="id" fit="true" queryMode="group"  showText="true">
	<%--   update-end--Author:tanghan  Date:20130713 for添加checkbox--%>
	<t:dgCol title="账号" field="acctno"  width="100"></t:dgCol>
	<t:dgCol title="户名" field="acctna"  width="60"></t:dgCol>
	
	<t:dgCol title="rowkey" field="rowkey" hidden="true" width="120"></t:dgCol>
	<t:dgCol title="开户日期" field="opendt" width="60"></t:dgCol>
	<t:dgCol title="销户日期" field="closdt"   width="60"></t:dgCol>
	<t:dgCol title="余额" field="lastbl" width="80"></t:dgCol>
	<t:dgCol title="状态" field="acctst" width="60" ></t:dgCol>
	<t:dgCol title="币种" field="crcycd" width="60" ></t:dgCol>
	<t:dgCol title="开户机构" field="brhnm" width="60"></t:dgCol>
	<%--
	<t:dgToolBar title="导出Excel" icon="icon-search" onclick="inAllAccountInfoListExportXls();"></t:dgToolBar>
	 --%>

</t:datagrid>
<div id="inAllAccountInfoListtb" style="padding: 3px; height: 65px">
	<div align="left">
		账号: <input id="acctno" name="acctno" style="width: 120px"> 
		科目代码:<select class="easyui-combotree" data-options="url:'itemController.do?getOrgTree',cascadeCheck:false"
	             id="itemSelect" name="itemSelect" datatype="select1">
	         <c:forEach items="${itemList}" var="item">
	             <option value="${item.itemcd }">${item.itemna}</option>
	         </c:forEach>
	     </select>
	     <input id="dtitcd" name="dtitcd" type="hidden">
	     状态:<select id="acctst" name="acctst">
	           <option value="">----请选择----</option>
	           <option value="0">关闭</option>
	           <option value="1">正常</option>
	     </select>
	     币种:<select id="crcycd" name="crcycd" >
	           <option value="">----请选择----</option>
	           <option value="01">人民币</option>
	           <option value="12">英镑</option>
	           <option value="13">港币</option>
	           <option value="14">美元</option>
	           <option value="15">瑞士法郎</option>
	           <option value="18">新加坡元</option>
	           <option value="27">日元</option>
	           <option value="28">加元</option>
	           <option value="29">澳元</option>
	           <option value="38">欧元</option>
	     </select>
	     核算机构: <select class="easyui-combotree" data-options="url:'departController.do?getTree', cascadeCheck:false"
                        id="orgSelect" name="orgSelect" datatype="select1">
                    <c:forEach items="${departList}" var="depart">
                        <option value="${depart.orgCode }">${depart.departname}</option>
                    </c:forEach>
                </select>
             <input id="acctbrh" name="acctbrh" type="hidden">
	</div>
	<div align="right">
		<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="inAllAccountInfoListsearch();">查询</a>
	</div>
	<div align="left">
		<a href="#" class="easyui-linkbutton" iconCls="icon-putout" onclick="inAllAccountInfoListExportXls();">导出</a>
	</div>
</div>


</div>
</div>
<script type="text/javascript">
	function test(){
		var param = getParams();
    	alert(param);
	}
	function setValues() {
	  var acctbrh = $("#orgSelect").combotree("getValues");
	  $("#acctbrh").val(acctbrh);
	  var dtitcd = $("#itemSelect").combotree("getValues");
	  $("#dtitcd").val(dtitcd);
	}
    function isNull(pa){
	  var resp='';
	  if(pa ==null || pa==''){
	    resp+=';';
	  }else{
	  	resp+=pa+ ';';
	  }
	   return resp;
	}
    function getParams(){
    	setValues();
	    var acctno= $('#acctno').val();
	    var dtitcd= $('#dtitcd').val();
	    var acctst = $('#acctst option:selected').val();
	    var crcycd= $('#crcycd option:selected').val();
	    var acctbrh= $('#acctbrh').val();
	    var param =isNull(acctno) + isNull(acctbrh) + isNull(dtitcd) + isNull(acctst) + isNull(crcycd);
        return param;	                  
    }
     function onLoadSuccess(){
       var startkey = getrowkey(1);
       var endkey = getrowkey(0);
       $('#inAllAccountInfoList').datagrid('options').queryParams={'startkey':startkey,'endkey':endkey,'param':getParams()};
       
    }
    function getrowkey(flag){
        var  rowkey;
    	var datas = $('#inAllAccountInfoList').datagrid('getRows');
    	var le ;
    	if(flag==0){//下一页
    	   le = $('#inAllAccountInfoList').datagrid('getData').rows[datas.length-1];
    	}else if(flag==1){//上一页
    	   le = $('#inAllAccountInfoList').datagrid('getData').rows[0];
    	}else{
    	  le ='';
    	  return '';
    	}
    	if(null != le && le !=''){
	    	for(var i in le){
	    		if(i=='rowkey'){
	    			rowkey=le[i];
    				return rowkey;
	    		}
	    	}
    	}
    }
    
    function inAllAccountInfoListExportXls(){
    	var param = getParams();
    	JeecgExcelExport("judicialControll.do?inAllAccountInfoDown&param="+param,"inAllAccountInfoList");
    }
    
    function inAllAccountInfoListsearch(){
    	var param = getParams();
    	$('#inAllAccountInfoList').datagrid({
    		url: 'judicialControll.do?inAllAccountInfoQuery&param='+param+'&field=acctno,dtitcd,acctst,crcycd,acctbrh,rowkey,acctna,opendt,closdt,lastbl,brchno,brhnm,'
    	});
    }
</script>